<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="icon" href="../img/system/icon/Exchange-logo.jpg" type="image/x-icon">
		<title>易置-个人中心</title>
		<link rel="stylesheet" type="text/css" href="../css/Personal.css"/>
		<link rel="stylesheet" type="text/css" href="../css/Personal-dialog-001.css"/>
	</head>
	<body>
		<?php 
			session_start();
		?>
		<div class="wrapper">
			<div class="inside">
				<div class="header">
					<span id="center">个人中心</span>
					<span id="index"><a href="#" onclick="javascript:history.back(-1);">首页</a></span>
				</div>
			</div>
			<div class="inside02">
				<div class="nav">
					<?php
					$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
					or die("无法连接到数据库");
					mysqli_query($db,"set names 'utf8'");
					$q="SELECT * FROM tb_user WHERE username='".$_SESSION['username']."' ";//定义一条SQL文件，以表单提交的username文本框中的数据为条件从tb_login表格查询数据
					$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
					if ($result->num_rows > 0) {
  					// 输出数据
  						while($row = $result->fetch_assoc()) {
   						$img_pathi=$row["userlogo_path"];
					?>
					<img class="logo_user" src="../img/user/icon-user/<?php echo $img_pathi; ?>"/>
					<?php
						}
					}
					mysqli_close($db);
					?>
						<ul>
							<li id="first">基本信息</li>
							<li><span id="shoppingCart">我的发布</span></li>
							<!--<li><span id="store"><a href="mystore.html">我的帖子</a> </span></li>-->
							<li><span id="order">我的帖子</span></li>
							<li><span id="like">关注</span></li>
							<li><span id="collect">收藏</span></li>
							<li><span id="history">历史</span></li>
							<li><span id="we">我们</span></li>
						</ul>
				</div>
				<div class="content">
					<div class="user">
						<span><b>基本信息</b></span>
						<ul id="left">
							<li>账户名：</li>
							<li>账户密码：</li>
							<li>昵称：</li>
							<li>性别：</li>
							<li>地区：</li>
						</ul>
						<ul id="right">
							<li><?php echo $_SESSION['username'];?></li>
							<li>**********</li>
							<?php
								$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
								or die("无法连接到数据库");
								mysqli_query($db,"set names 'utf8'");
								$q="SELECT * FROM tb_user WHERE username='".$_SESSION['username']."' ";//定义一条SQL文件，以表单提交的username文本框中的数据为条件从tb_login表格查询数据
								$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
								if ($result->num_rows > 0) {
  								// 输出数据
  								while($row = $result->fetch_assoc()) {
   								$user_nicknamei=$row["user_nickname"];
   								$sexi=$row["sex"];
   								$addressi=$row["address"];
							?>
							<li><?php echo $user_nicknamei; ?></li>
							<li><?php echo $sexi; ?></li>
							<li><?php echo $addressi; ?></li>
							<?php
								}
							}
							mysqli_close($db);
							?>
						</ul>
						<!--<ul id="right02">
							<li><a href="#">修改密码</a></li>
							<li><a href="#">修改昵称</a></li>
							<li><a href="#">修改性别</a></li>
							<li><a href="#">修改地区</a></li>
						</ul>-->
						<input id="user-submit" type="submit" value="信息编辑" onclick="popBox()"/>
					</div>
					<div class="shopping">
						<span><b>我的发布</b></span>
						<?php
							$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
							or die("无法连接到数据库");
							mysqli_query($db,"set names 'utf8'");
							$q="SELECT * FROM tb_goods WHERE username='".$_SESSION['username']."'";
							$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
							if ($result->num_rows > 0) {
  							// 输出数据
  								while($row = $result->fetch_assoc()) {
  								$img_pathi=$row["img_path"];
   								$goods_namei=$row["goods_name"];
   								$goods_moneyi=$row["goods_money"];
							?>
						<div class="goods_manage">
							<img id="goods_manage_img" src="../img/system/goods/<?php echo $img_pathi; ?>"/>
							<span id="goods_manage_name"><?php echo $goods_namei; ?></span>
							<span id="goods_manage_money">￥<?php echo $goods_moneyi; ?></span>
							<span id="status">已发送</span>
						</div>
						<?php
								}
							}
							mysqli_close($db);
							?>
						<input id="publish-submit" type="submit" value="发布更多" onclick="popBox002()"/>
					</div>
					<div class="order">
						<span><b>我的帖子</b></span>
						<?php
							$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
							or die("无法连接到数据库");
							mysqli_query($db,"set names 'utf8'");
							$q="SELECT * FROM tb_goods_neinfo WHERE username='".$_SESSION['username']."'";
							$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
							if ($result->num_rows > 0) {
  							// 输出数据
  								while($row = $result->fetch_assoc()) {
   								$goods_namei=$row["goods_name"];
   								$goods_moneyi=$row["goods_money"];
							?>
						<div class="goods_manage">
							<img id="goods_manage_img" src="../img/user/icon-user/goods.jpg"/>
							<span id="goods_manage_name"><?php echo $goods_namei; ?></span>
							<span id="goods_manage_money">￥<?php echo $goods_moneyi; ?></span>
							<span id="status">已发送</span>
						</div>
						<?php
								}
							}
							mysqli_close($db);
							?>
						<input id="post-submit" type="submit" value="发送更多" onclick="popBox003()"/>
					</div>
					<div class="like">
						<span><b>关注的卖家</b></span>
						<?php
							$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
							or die("无法连接到数据库");
							mysqli_query($db,"set names 'utf8'");
//							$q="SELECT * FROM tb_user WHERE username='".$_SESSION['username']."' ";//定义一条SQL文件，以表单提交的username文本框中的数据为条件从tb_login表格查询数据
							$q="SELECT * FROM tb_user WHERE username IN (SELECT another_username FROM tb_concern WHERE username='".$_SESSION['username']."')";
							$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
							if ($result->num_rows > 0) {
  							// 输出数据
  								while($row = $result->fetch_assoc()) {
   								$img_pathi=$row["userlogo_path"];
   								$user_nicknamei=$row["user_nickname"];
							?>
						<div class="store_like">
							<img id="store_like_img" src="../img/user/icon-user/<?php echo $img_pathi; ?>"/>
							<span id="store_like_name"><?php echo $user_nicknamei; ?></span>
							<span id="store_like_more">更多></span>
							<span id="like_status" title="单击取消关注">已关注</span>
						</div>
						<?php
								}
							}
							mysqli_close($db);
							?>
					</div>
					<div class="collect">
						<span><b>收藏的物品</b></span>
						<?php
							$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
							or die("无法连接到数据库");
							mysqli_query($db,"set names 'utf8'");
							$q="SELECT * FROM tb_goods WHERE goods_id IN (SELECT goods_id FROM tb_collect WHERE username='".$_SESSION['username']."')";
							$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
							if ($result->num_rows > 0) {
  							// 输出数据
  								while($row = $result->fetch_assoc()) {
   								$img_pathi=$row["img_path"];
   								$goods_namei=$row["goods_name"];
   								$goods_moneyi=$row["goods_money"];
							?>
						<div class="goods_collect">
							<img id="goods_collect_img" src="../img/system/goods/<?php echo $img_pathi; ?>"/>
							<span id="goods_collect_name"><?php echo $goods_namei; ?></span>
							<span id="goods_collect_money">￥<?php echo $goods_moneyi; ?></span>
							<span id="collect_status" title="单击取消收藏">已收藏</span>
						</div>
						<?php
								}
							}
							mysqli_close($db);
							?>
					</div>
					<div class="history">
						<span><b>历史浏览</b></span>
						<?php
							$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
							or die("无法连接到数据库");
							mysqli_query($db,"set names 'utf8'");
							$q="SELECT * FROM tb_goods WHERE goods_id IN (SELECT goods_id FROM tb_history WHERE username='".$_SESSION['username']."')";
							$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
							if ($result->num_rows > 0) {
  							// 输出数据
  								while($row = $result->fetch_assoc()) {
   								$img_pathi=$row["img_path"];
   								$goods_namei=$row["goods_name"];
   								$goods_moneyi=$row["goods_money"];
							?>
						<div class="goods_history">
							<img id="goods_history_img" src="../img/system/goods/<?php echo $img_pathi; ?>"/>
							<span id="goods_history_name"><?php echo $goods_namei; ?></span>
							<span id="goods_history_money">￥<?php echo $goods_moneyi; ?></span>
							<span id="come_in" title="单击继续浏览">继续浏览></span>
						</div>
						<?php
								}
							}
							mysqli_close($db);
							?>
					</div>
					<div class="you_and_us">
						<span><b>您与易置</b></span>
						<div class="you">
							<?php
								$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
								or die("无法连接到数据库");
								mysqli_query($db,"set names 'utf8'");
								$q="SELECT * FROM tb_goods WHERE username='".$_SESSION['username']."' ";//定义一条SQL文件，以表单提交的username文本框中的数据为条件从tb_login表格查询数据
								$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
								if ($result->num_rows >0) {
  								// 输出数据
  								while($row = $result->fetch_assoc()) {
   								$num_rowsi=$result->num_rows;
   								}
							}
							?>
							您已经在易置发布物品：<span id="publish_amount"><?php echo $num_rowsi; ?>件</span><br />
							<?php
							mysqli_close($db);
							?>
							<?php
								$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
								or die("无法连接到数据库");
								mysqli_query($db,"set names 'utf8'");
								$q="SELECT * FROM tb_goods_neinfo WHERE username='".$_SESSION['username']."' ";//定义一条SQL文件，以表单提交的username文本框中的数据为条件从tb_login表格查询数据
								$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
								if ($result->num_rows >0) {
  								// 输出数据
  								while($row = $result->fetch_assoc()) {
   								$num_rowsi=$result->num_rows;
   								}
							}
							?>
							您已发送帖子：<span id="sell_amount"><?php echo $num_rowsi; ?>件</span><br />
							<?php
							mysqli_close($db);
							?>
							<!--您已购买：<span id="buy_amount">50件</span>-->
							
							<span id="now_info">小愿望：感谢您一直以来的信任与支持！愿我们与您携手共创校园交易的未来！</span>
						</div>
					</div>
				</div>
				<!--底部-->
				<div class="footer02">
					<ul>
						<li>关于我们&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>联系我们&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>诚招英才&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>论坛&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>友情链接&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>相关产品</li>
					</ul>
				</div>
				<div class="footer02_about">
					<hr />
					<ul>
						<li>用户协议&nbsp;&nbsp;|&nbsp;&nbsp;</li>
						<li>隐藏协议&nbsp;&nbsp;|&nbsp;&nbsp;</li>
						<li>Copyright © 2019  易置开发团队版权所有</li>
					</ul>
				</div>
			</div>
		</div>
	<!--001(信息编辑)对话框-->
		<div id="popLayer"><!--弹出框打开时整个页面的背景色-->
		</div>
		<div id="popBox"><!--弹出框底色-->
    		<div class="top01">
       			 <div class="top01-in">
            		<font size="4.5px">&nbsp;信息编辑</font>
        		</div>
    		</div>
   			<div class="dialog-left">
				 <ul>
				 	<li>账户名</li>
				 	<li>账户密码</li>
				 	<li>昵称</li>
				 	<li>性别</li>
				 	<li>地区</li>
				 </ul>      		
   			</div>
   			<form action="../model/update_user_ok.php" method="post">
   			<div class="dialog-right">
				<ul>
				 	<li><input type="text" name="username" id="" value="<?php echo $_SESSION['username']; ?>" /></li>
				 	<li><input type="text" name="password" id="" value="" /></li>
				 	<li><input type="text" name="user_nickname" id="" value="" /></li>
				 	<li><input type="text" name="sex" id="" value="" /></li>
				 	<li><input type="text" name="address" id="" value="" /></li>
				</ul>      		
   			</div>
   			<div class="dialog-bottom">
   				<input type="submit" id="preserved" value="保存" />
   				<input type="button" id="cancle" value="取消" onclick="closeBox()" />
   			</div>	
   			</form>
		</div>
		<!--对话框结束-->	
		
		<!--002(信息编辑)对话框-->
		<div id="popLayer002"><!--弹出框打开时整个页面的背景色-->
		</div>
		<div id="popBox002"><!--弹出框底色-->
    		<div class="top01">
       			 <div class="top01-in">
            		<font size="4.5px">&nbsp;发布更多</font>
        		</div>
    		</div>
   			<div class="dialog-left">
				 <ul>
				 	<li>图片</li>
				 	<li>类型</li>
				 	<li>物品名称</li>
				 	<li>转卖价</li>
				 	<li>成色</li>
				 	<li>发布到</li>
				 	<li>取货方式</li>
				 	<li>数量</li>
				 	<li>联系电话</li>
				 	<li>您的QQ</li>
				 	<li>您的微信</li>
				 	<li>您的状态</li>
				 </ul>      		
   			</div>
   			<form action="../model/fileUpload_publish_goods_ok.php" method="post" enctype="multipart/form-data">
   			<div class="dialog-right">
				<ul>
				 	<li><input type="file" name="file" id="file"></li>
				 	<li><select name="goods_type">
							<option value="手机">手机</option>
							<option value="电子">电子</option>
							<option value="衣装">衣装</option>
							<option value="运动">运动</option>
							<option value="其他">其他</option>
						</select>
				 	</li>
				 	<li><input type="text" id="" name="goods_name" value="" /></li>
				 	<li><input type="text" id="" name="goods_money" value="" /></li>
				 	<li><select name="quality">
					    	<option value="九成新">九成新</option>
							<option value="七成新">七成新</option>
							<option value="五成新">五成新</option>
				  		</select>
				 	</li>
				 	<li><input type="text" id="" name="school_address" value="" /></li>
				 	<li><select name="exchange_way">
							<option value="自提">自提</option>
							<option value="支持快递">支持快递</option>
						</select>
				 	</li>
				 	<li><input type="text" id="" name="number" value="" /></li>
				 	<li><input type="text" id="" name="contact_phone" value="" /></li>
				 	<li><input type="text" name="contact_qq" value=""/></li>
				 	<li><input type="text" name="contact_wechat" value=""/></li>
				 	<li><select name="exchange_status">
							<option value="在线">在线</option>
							<option value="离线">离线</option>
						</select>
				 	</li>
				 	<?php
								$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
								or die("无法连接到数据库");
								mysqli_query($db,"set names 'utf8'");
								$q="SELECT * FROM tb_user WHERE username='".$_SESSION['username']."' ";//定义一条SQL文件，以表单提交的username文本框中的数据为条件从tb_login表格查询数据
								$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
								if ($result->num_rows > 0) {
  								// 输出数据
  								while($row = $result->fetch_assoc()) {	
   								$user_nicknamei=$row["user_nickname"];
							?>
				 	<input type="text" name="user_nickname" style="display: none;" value="<?php echo $user_nicknamei; ?>" />
				 	<?php
								}
							}
							mysqli_close($db);
							?>
					<input type="text" name="username" style="display: none;" value="<?php echo $_SESSION['username']; ?>" />
				</ul>      		
   			</div>
   			<div class="dialog-bottom002">
   				<input type="submit" id="preserved" value="发布" />
   				<input type="button" id="cancle" value="取消" onclick="closeBox002()" />
   			</div>	
   			</form>
		</div>
		<!--对话框结束-->
		
		<!--003(信息编辑)对话框-->
		<div id="popLayer003"><!--弹出框打开时整个页面的背景色-->
		</div>
		<div id="popBox003"><!--弹出框底色-->
    		<div class="top01">
       			 <div class="top01-in">
            		<font size="4.5px">&nbsp;发送更多</font>
        		</div>
    		</div>
   			<div class="dialog-left">
				 <ul>
				 	<li>类型</li>
				 	<li>物品名称</li>
				 	<li>转卖价</li>
				 	<li>成色</li>
				 	<li>发布到</li>
				 	<li>取货方式</li>
				 	<li>数量</li>
				 	<li>联系电话</li>
				 	<li>您的QQ</li>
				 	<li>您的微信</li>
				 	<li>您的状态</li>
				 </ul>      		
   			</div>
   			<form action="../model/publish_goods_neinfo_ok.php" method="post">
   			<div class="dialog-right">
				<ul>
				 	<li><select name="goods_type">
							<option value="手机">手机</option>
							<option value="电子">电子</option>
							<option value="衣装">衣装</option>
							<option value="运动">运动</option>
							<option value="其他">其他</option>
						</select>
				 	</li>
				 	<li><input type="text" id="" name="goods_name" value="" /></li>
				 	<li><input type="text" id="" name="goods_money" value="" /></li>
				 	<li><select name="quality">
					    	<option value="九成新">九成新</option>
							<option value="七成新">七成新</option>
							<option value="五成新">五成新</option>
				  		</select>
				 	</li>
				 	<li><input type="text" id="" name="school_address" value="" /></li>
				 	<li><select name="exchange_way">
							<option value="自提">自提</option>
							<option value="支持快递">支持快递</option>
						</select>
				 	</li>
				 	<li><input type="text" id="" name="number" value="" /></li>
				 	<li><input type="text" id="" name="contact_phone" value="" /></li>
				 	<li><input type="text" name="contact_qq" value=""/></li>
				 	<li><input type="text" name="contact_wechat" value=""/></li>
				 	<li><select name="exchange_status">
							<option value="在线">在线</option>
							<option value="离线">离线</option>
						</select>
				 	</li>
				 	<?php
								$db=@mysqli_connect('localhost','root','123456','db_exchange')//利用mysqli_connect()连接到数据库
								or die("无法连接到数据库");
								mysqli_query($db,"set names 'utf8'");
								$q="SELECT * FROM tb_user WHERE username='".$_SESSION['username']."' ";//定义一条SQL文件，以表单提交的username文本框中的数据为条件从tb_login表格查询数据
								$result=mysqli_query($db,$q);//利用mysqli_query()来执行上面的SQL文件，将结果返回给$result
								if ($result->num_rows > 0) {
  								// 输出数据
  								while($row = $result->fetch_assoc()) {	
   								$user_nicknamei=$row["user_nickname"];
							?>
				 	<input type="text" name="user_nickname" style="display: none;" value="<?php echo $user_nicknamei; ?>" />
				 	<?php
								}
							}
							mysqli_close($db);
							?>
					<input type="text" name="username" style="display: none;" value="<?php echo $_SESSION['username']; ?>" />		
				</ul>      		
   			</div>
   			<div class="dialog-bottom003">
   				<input type="submit" id="preserved" value="发送" />
   				<input type="button" id="cancle" value="取消" onclick="closeBox003()" />
   			</div>	
   			</form>
		</div>
		<!--对话框结束-->
	<script src="../js/jquery-3.4.1.js"></script>
    <script src="../js/Personal.js"></script>
    <script src="../js/Persoanl-dialog001.js"></script>
	</body>
</html>
